import itertools

a = [1, 2, '\n', 3, 4, '\n', 5, 6]
new_list = [list(x) for k,x in itertools.groupby(a,key=lambda x : x!='\n') if k]
print(new_list)
# 输出：[[1, 2], [3, 4], [5, 6]]

multi_dim_list = [[1, 2, 3, 4, 5], 
                  [6, 7, 8, 9, 0],
                  [3, 45, 6, 7, 2]]

for sublist in multi_dim_list:
    print(sublist)

# 输出每一行作为一个子列表显示出来